package com.caopeng.achievementmanagement.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Crescent_P
 * @date 2021-12-05 10:12
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    // 加过滤器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
                .addPathPatterns("/")
                .addPathPatterns("/**")
                .excludePathPatterns("/static/**")
                .excludePathPatterns("/css/**")
                .excludePathPatterns("/js/**")
                .excludePathPatterns("/images/**")
                .excludePathPatterns("/toLogin")
                .excludePathPatterns("/login")
                .excludePathPatterns("/toRegister");
    }
}
